<style scoped lang="stylus" rel="stylesheet/stylus">
  @import "./login.styl";
</style>

<template>
  <div class="bg_img">
    <img class="top_img" src="../img/ic_name.png"/>
    <div class="login_bg">
      <div class="text">用户名</div>
      <input class="admin" type="text" placeholder="  请输入您的用户名" v-model="username">
      <div class="text2">密码</div>
      <input class="admin" type="password" placeholder="  请输入您的密码" v-model="password">
      <input class="login" type="submit" value="登录" @click="loginClick()">
    </div>
  </div>
</template>

<script>
  import { mapMutations } from 'vuex'
export default {
  name: 'login_bg',
  data () {
    return {
      isHidden: false,
      username: '13146187588',
      password: 'CE0BFD15059B68D67688884D7A3D3E8C'
    }
  },
  methods: {
    ...mapMutations({
      setUsername: 'SET_USERNAME'
    }),
    loginClick: function () {
      let params = {
        loginName: this.username,
        password: this.password
      }
      this.$ajaxApi.getLogin(params).then((result) => {
        this.setUsername(this.username)
        this.$router.push({path: 'home', query: {name: '李四'}})
      }, (result) => {

      })
    }
  }
}
</script>
